import os
from abc import abstractmethod

from common.context.base_entity import BaseResult
from common.context.global_context import GlobalContext
from database.elasticsearch.es import ES
from database.mapper import boards_info, stock_day_k
from service import period_service
from utils import parse_util, functions, dict_util, doc_util, read_config, date_util


class BigDataTrain(BaseResult):
    def __init__(self, code):
        super().__init__()
        self.code = code  # 编码
        self.income_ext_data = None  # 扩展传入信息,没有传空

    # 执行策略
    @abstractmethod
    def train(self):
        print('开始执行数据训练' + str(self.code))


class BigDataTrain1(BigDataTrain):
    def train(self):
        # l2k1(GlobalContext(self.code))
        cdft(GlobalContext(self.code))
        return self


# k线相似度
def cdft(glc: GlobalContext):
    print('cdft')


if __name__ == '__main__':
    print('大数据训练开始')
    # period_list = cal_period(GlobalContext('601600'))
    BigDataTrain1('601600').train()
    BigDataTrain1('002460').train()
    BigDataTrain1('601633').train()
    BigDataTrain1('600316').train()
    BigDataTrain1('600460').train()
    # format_data()
    print('大数据训练结束')
